//
//  UILabel+SYAdd.m
//  SYSDK
//
//  Created by ligq on 2020/4/13.
//  Copyright © 2020 synjones. All rights reserved.
//

#import "UILabel+SYAdd.h"

@implementation UILabel (SYAdd)

+ (instancetype)labelWithBackgroundColor:(UIColor *)color{
    
    UILabel *label = [[self alloc] init];
    label.backgroundColor     = color;
    
    return label;
}

+ (instancetype)labelWithTitle:(NSString *)title font:(UIFont *)font textColor:(UIColor *)color{
    
    // 默认左对齐
    return [self labelWithTitle:title font:font textColor:color alignment:NSTextAlignmentLeft];
}

+ (instancetype)labelWithTitle:(NSString *)title font:(UIFont *)font textColor:(UIColor *)color alignment:(NSTextAlignment)textAlignment{
    
    UILabel *label = [[self alloc] init];
    label.text              = title;
    label.font              = font;
    label.textColor         = color;
    label.textAlignment     = textAlignment;
    
    return label;
}

- (instancetype)setupTitle:(NSString *)title font:(UIFont *)font textColor:(UIColor *)color alignment:(NSTextAlignment)textAlignment{
    
    self.text              = title;
    self.font              = font;
    self.textColor         = color;
    self.textAlignment     = textAlignment;
    
    return self;
}
- (instancetype)setupattributedTitle:(NSMutableAttributedString *)title font:(UIFont *)font textColor:(UIColor *)color numberLines:(NSInteger)number{
    
    self.attributedText    = title;
    self.font              = font;
    self.textColor         = color;
    self.numberOfLines     = number;
    
    return self;
}

- (instancetype)setupTitle:(NSString *)title font:(UIFont *)font textColor:(UIColor *)color{
    
    return [self setupTitle:title font:font textColor:color alignment:NSTextAlignmentLeft];
}

-(instancetype)setupTitle:(NSString *)title font:(UIFont *)font textColor:(UIColor *)color borderColor:(UIColor *)bordercolor borderWidth:(CGFloat)borderwidth{
    
    self.text = title;
    self.font = font;
    self.textColor = color;
    self.layer.borderColor = bordercolor.CGColor;
    self.layer.borderWidth = borderwidth;
    
    return self;
}

@end
